package stringDemo;

import java.util.Scanner;
//字符串比较
public class StringTest {
    public static void main(String[] args) {
        login();
    }
    public static void login(){
        System.out.println(" 请输入用户名与密码：");
        Scanner scanner=new Scanner(System.in);
        String username="bob";
        String password="123";
        for (int i = 0; i <3 ; i++) {
            String user=scanner.nextLine();
            String pass=scanner.nextLine();
            if (user.equals(username)&&pass.equals(password)){
                System.out.println("login success!!");
                break;
            }else {
                System.out.println("login failed");
            }
        }

    }
}
